package com.zjw.project.meeting.controller;

import com.zjw.entity.po.Demo;
import com.zjw.service.DemoService;
import com.zjw.util.result.ResultCode;
import com.zjw.util.result.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Classname DemoController
 * @Author guoweixin
 * @Description TODO
 * @Date 2021/1/20 10:58
 * @Created by Administrator
 */
@Controller
@RequestMapping("demo")
public class DemoController {
    @Autowired
    private DemoService demoService;

    @ResponseBody
    @GetMapping("info")
    public Demo selectById(@RequestParam("id") final int id){
        return demoService.selectById(id);
    }

    @ResponseBody
    @GetMapping("info1")
    public ResultJson selectById1(@RequestParam("id") final int id){
        Demo demo=demoService.selectById(id);
        if(demo==null){
            return  new ResultJson(null, ResultCode.NOT_DATA.getCode(),ResultCode.NOT_DATA.getMsg());
        }
        return new ResultJson(demo,ResultCode.SUCCESS);
    }
}
